import decimal
from decimal import *

d = decimal.Decimal(1.1)
print('Precision:')
print('{:.1}'.format(d))
print('{:.2}'.format(d))
print('{:.3}'.format(d))
print('{:.18}'.format(d))

print('\nWidth and precision combined:')
print('{:5.1f} {:5.1g}'.format(d, d))
print('{:5.2f} {:5.2g}'.format(d, d))
print('{:5.3f} {:5.3g}'.format(d, d))

print('\nZero padding:')
print('{:05.1}'.format(d))
print('{:05.2}'.format(d))
print('{:05.3}'.format(d))

for v, k in decimal.__dict__.ite:
    print(f'    {v:}:   {k:}')

# data = list(map(Decimal, '1.34 1.87 3.45 2.35 1.00 0.03 9.25'.split()))
# print(max(data))
#
# print(min(data))
#
# print(sorted(data))
#
# print(sum(data))
#
# a, b, c = data[:3]
# print("--------------")
# print('a=' + str(a))
#
# print(float(a))
#
# print(round(a, 1))
#
# print(int(a))
#
# print(a * 5)
#
# print(a * b)
#
# print(c % a)
# print("-----------")
# print()
# a = Decimal('-10032.4555')
# ndigits = 2
# b = Decimal('1.34')
# # a:>+8.3d
# print(f"|{a: =+20.4f}|")
# print(f"|{b:20.3f}|")
# getcontext().rounding = ROUND_DOWN
# print(f"round_down:{round(a, ndigits)}")
# getcontext().rounding = ROUND_UP
# print(f"round_up:{round(a, ndigits)}")
# getcontext().rounding = ROUND_FLOOR
# print(f"round_floor:{round(a, ndigits)}")
# getcontext().rounding = ROUND_CEILING
# print(f"round_ceil:{round(a, ndigits)}")
# getcontext().rounding = ROUND_HALF_UP
# print(f"--round_half_up:{round(a, ndigits)}")
# getcontext().rounding = ROUND_HALF_DOWN
# print(f"--round_half_down:{round(a, ndigits)}")
# getcontext().rounding = ROUND_HALF_EVEN
# print(f"round_half_even:{round(a, ndigits)}")
# getcontext().rounding = ROUND_05UP
# print(f"round_05up:{round(a, ndigits)}")
# c=5.255
# print(f"c={round(a,ndigits)}")
